package com.rover022.flixelgame.vo
{
	import com.rover022.flixelgame.utils.ObjectFactory;

	public class ItemVo
	{
		public static var ITEM_USE:uint = 0;
		public static var ITEM_EQUIT:uint = 1;
		public static var ITEM_DEBRIS:uint = 2;
		public static var MAXCOUNT:uint = 99;
		public var id:String = "0"
		public var name:String = "?"
		private var _count:Number = 1;
		public var type:uint = ITEM_USE;
		public var imageUrl:String = "";
		public var quality:uint = 0;
		/**
		 * 它可以合成那些道具的数组
		 */
		public var compositeItems:Array = [];
		/**
		 * 合成他自己本身所需要那些道具的数组
		 */
		public var needCompositeItems:Array = [];

		public function ItemVo()
		{
		}

		public function get count():Number
		{
			return _count;
		}

		public function set count(value:Number):void
		{
			_count = value;
			if (_count > MAXCOUNT)
			{
				_count = MAXCOUNT;
			}
		}

		public function copy():ItemVo
		{
			var itemvo:ItemVo = new ItemVo();
			itemvo.id = id;
			itemvo.name = name;
			itemvo.count = count;
			itemvo.type = type;
			itemvo.imageUrl = imageUrl;
			itemvo.quality = quality;
			itemvo.compositeItems = ObjectFactory.clone(compositeItems) as Array;
			itemvo.needCompositeItems = ObjectFactory.clone(needCompositeItems) as Array;
			return itemvo;
		}
	}
}
